<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>demo</title>
    <script src="https://unpkg.com/vue@3.0.5/dist/vue.global.js"></script>
  </head>

  <body>
    <div id="app"></div>
    <script>
      const app = Vue.createApp({
        data() {
          return {};
        },
        methods: {
          keydown(jp) {
            console.log("键盘事件", jp.code);
            if (jp.code === "Tab") {
              console.log("TAB");
            }
          },
          enter() {
            console.log("回车事件");
          },
          click() {
            console.log("点击鼠标左键");
          },
          rightclick() {
            console.log("点击鼠标右键");
          },
          centerclick() {
            console.log("点击鼠标中键");
          },
        },
        template: `
          <div>
            <input type='text' @keydown='keydown' /><br/>
            <input type='text' @keydown.enter='enter' /><br/>
            <input type='text' @click='click' @click.right='rightclick' @click.middle='centerclick' /><br/>
          </div>
        `,
      });

      const vm = app.mount("#app");
    </script>
  </body>
</html>
